package com.zmc.dynamic.shard.rule.service.Impl;

import com.zmc.dynamic.shard.constant.ShardingTablePrefixConstant;
import com.zmc.dynamic.shard.rule.service.ShardingRuleService;

import java.util.Collection;

public class ShardingRuleFactory {



    public ShardingRuleService getRule(Collection<String> collection) {
        String tableName = collection.iterator().next();
        if (tableName.startsWith(ShardingTablePrefixConstant.ORDER_PREFIX)) {
            return new OrderShardingRuleServiceImpl();
        }
        return new DefaultShardingRuleServiceImpl();
    }
}
